package com.spring.ai.config;

import dev.langchain4j.community.model.dashscope.QwenStreamingChatModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 模型流式注入
 */
@Configuration
public class ModelStreamConfig {
    @Value("${langchain4j.community.dashscope.chat-model.api-key}")
    private String apiKey;
    @Value("${langchain4j.community.dashscope.chat-model.model-name}")
    private String modelName;

    @Value("${langchain4j.community.dashscope.chat-model.base-url}")
    private String baseUrl;

    /**
     * qwen大模型流式注入
     */
    @Bean
    public StreamingChatLanguageModel qwenStreamingChatModel() {
        return QwenStreamingChatModel.builder()
                .apiKey(apiKey)
                .modelName(modelName)  // 根据实际模型名调整
                .baseUrl(baseUrl)
                .build();
    }


}
